package com.xysq.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.xysq.adapter.BrowseAdapter;
import com.xysq.lemon.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.InjectView;

/**
 * @Author huangdongkai
 * 商品浏览页
 */

public class BrowseActivity extends BaseActivity implements ViewPager.OnPageChangeListener {

    @InjectView(R.id.view_pager)
    ViewPager pagerView;

    private BrowseAdapter browseAdapter;
    private List<Fragment> fragmentList = new ArrayList<Fragment>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_browse);
        initView();
        getData();
    }

    private void initView() {
        pagerView.setOnPageChangeListener(this);
    }

    private void getData() {
        browseAdapter = new BrowseAdapter(getSupportFragmentManager(), fragmentList);
        pagerView.setAdapter(browseAdapter);
    }

    @Override
    public void onPageScrolled(int i, float v, int i1) {

    }

    @Override
    public void onPageSelected(int i) {

    }

    @Override
    public void onPageScrollStateChanged(int i) {

    }
}